package com.example.musicplayer.activity;

import android.os.Bundle;

import com.example.musicplayer.R;
import com.example.musicplayer.settings.MusicPlayerSettings;
import com.example.musicplayer.settings.SettingsItem;
import com.example.musicplayer.view.SettingsView;

public class PlayListSettingsActivity extends BaseSettingsActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        initSettingsItem();
    }

    @Override
    protected int setActivityTitle() {
        return R.string.play_list_settings;
    }

    private void initSettingsItem() {
        setSettingsItem(SettingsItem.ADD_TO_PLAY_LIST_TAIL);
        setSettingsDivideItem();
    }

    @Override
    protected void updateSettingsItem(SettingsView settingsView) {
        super.updateSettingsItem(settingsView);
        if (settingsView.getSettingsItem() == SettingsItem.ADD_TO_PLAY_LIST_TAIL) {
            settingsView.setSwitchChecked(MusicPlayerSettings.isAddToPlayListTail());
        }
    }

    @Override
    protected void onSettingsItemClick(SettingsView settingsView, boolean isChecked) {
        super.onSettingsItemClick(settingsView, isChecked);
        if (settingsView.getSettingsItem() == SettingsItem.ADD_TO_PLAY_LIST_TAIL) {
            MusicPlayerSettings.setAddToPlayListTail(isChecked);
        }
    }
}